package per.wsj.okhttp

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import com.google.gson.reflect.TypeToken

class MainActivity2 : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        test1()
        test2()
        test3()

        val btn = findViewById<Button>(R.id.btnRequest1)
        btn.setOnClickListener {
            Toast.makeText(this,"",Toast.LENGTH_LONG).show()
        }
    }

    fun test1() {
        showData<List<String>>("123")
    }

    fun test2() {
        showData2<List<String>>()
    }

    fun test3() {
        val clazz = Class.forName("per.wsj.okhttp.MainActivity2\$test2\$\$inlined\$showData2\$1")
//        LogUtil.e("clazz: " + clazz.toGenericString())
//        LogUtil.e("clazz: " + clazz.genericSuperclass)
    }

    inline fun <T> showData(msg: String) {
        val type = object : TypeToken<T>() {}.type
        print(type)
    }

    inline fun <reified T> showData2() {
        val type = object : TypeToken<T>() {}.type
        val t = T::class.java
        print(t)
    }


}